package com.zzw.basic.finalize;

import java.lang.ref.PhantomReference;
import java.lang.ref.ReferenceQueue;

public class PhantomReferenceTest {

	public static void main(String[] args) {
		String str = new String("���Java����");
		ReferenceQueue queue = new ReferenceQueue();
		PhantomReference reference = new PhantomReference(str, queue);
		str = null;
		System.out.println(reference.get());
		System.gc();
		System.runFinalization();
		System.out.println(queue.poll() == reference);
	}
}